package com.meixiang.activity.account.login;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;

import com.meixiang.R;
import com.meixiang.activity.account.manager.VerifyRealNameActivity;
import com.meixiang.dialog.AlertDialogFragment;
import com.meixiang.main.BaseActivity;
import com.meixiang.main.MainActivity;

/**
 * 注册成功
 * author：wangzuzhen on 2016/5/5 0005 15:07.
 */
public class RegisterSucceedActivity extends BaseActivity {


    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case 1:
                    new AlertDialogFragment.Builder()
                            .setContentText(getResources().getString(R.string.dialog_register_succeed))
                            .setLeftBtnText(getResources().getString(R.string.dialog_register_no)).setLeftClickCallBack(new AlertDialogFragment.LeftClickCallBack() {
                        @Override
                        public void dialogLeftBtnClick() {
                            startActivity(new Intent(context, MainActivity.class));
                        }
                    })
                            .setRightBtnText(getResources().getString(R.string.dialog_register_yes))
                            .setRightClickCallBack(new AlertDialogFragment.RightClickCallBack() {
                                @Override
                                public void dialogRightBtnClick() {
                                    /**
                                     * 已认证传1，未认证传0
                                     */
                                    Intent intent = new Intent(context, VerifyRealNameActivity.class);
                                    intent.putExtra(VerifyRealNameActivity.IS_AUTHENTICATION, 0);
                                    startActivity(intent);
                                }
                            })
                            .build()
                            .show(getSupportFragmentManager(), AlertDialogFragment.TAG);
                    break;
            }
            super.handleMessage(msg);

        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_register_succeed);
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initTitle() {
        setTitle(getResources().getString(R.string.register_succeed));
        mHandler.sendEmptyMessageDelayed(1, 2000);
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void setData() {

    }

    @Override
    public void onClick(View v) {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mHandler.removeMessages(1);
    }
}
